package com.gf.framework.rediscachedemo.controller;

import com.gf.framework.common.result.R;
import com.gf.framework.rediscachedemo.vo.Student;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;

/**
 * @author gaofei
 * @Description
 * @create 2022/5/25 15:27
 */
@RestController
@Api(tags = "学生接口测试")
@RequestMapping("student")
@Slf4j
public class StudentController {
    @PostMapping("add")
    public Boolean add(@RequestBody Student student) {
        log.info(student.toString());
        return true;
    }

    @GetMapping("get")
    public Student get(@RequestParam("id")Integer id) {
        return new Student("demo", 20, LocalDate.of(1999, 1, 1));
    }

    @GetMapping("get2")
    public R<Student> get2(@RequestParam("id")Integer id) {
        return R.success(new Student("demo", 20, LocalDate.of(1999, 1, 1)));
    }
}
